import typescript from '@rollup/plugin-typescript'
import resolve from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'

export default [
  {
    input: 'packages/vue/src/index.ts', // 入口文件
    output: [
      // 导出iife包
      {
        sourcemap: true, // 开启sourcemap
        file: './packages/vue/dist/vue.js', // 导出文件地址
        format: 'iife', // 生成包的格式
        name: 'Vue', // 变量名
      },
    ],
    plugins: [
      // typescript
      typescript({
        sourceMap: true,
        outDir: '.',
      }),
      // 模块导入路径补全
      resolve(),
      // 转commonjs 为 esm
      commonjs({}),
    ],
  },
]
